< previous page page_113 next page >

Page 113
Examples of Variables
The scope of a variable determines which routines are allowed to view or change its value. If you declare a variable in an event procedure using the Dim statement, that variable is visible only to that procedure. Furthermore, when the event procedure ends, that variables value is discarded.
Variables declared with the Dim statement are allocated on the stack when the procedure is entered. The stack is a temporary area of memory, and the stack thats allocated for a procedure is discarded when the procedure exits, meaning that the contents of all local variables are discarded.
Examples Filename: VarExamples.frm
The form shown in Figure 6.2 will be used to demonstrate the various variable declaration types.
8160-0113a.gif
Figure 6.2
Examples of variables.
EXERCISE
Load the Sample Project for This Chapter
1. Load the sample project that goes with this chapter.
2. Run the first sample to follow along.
analysis.gifIf you load the sample for this chapter it may help you follow the logic for this narration.

 
< previous page page_113 next page >

If you like this book, buy it!